<?php

use App\Core\Traits\Database\SchemaCommentTrait;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNewsContentsTable extends Migration
{
    use SchemaCommentTrait;

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news_contents', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('记录ID');
            $table->bigInteger('news_id')->comment('新闻ID')->index();
            $table->longText('content')->comment('内容');
            $table->string('type', 20)->comment('内容类型,enum[html,text,markdown]')->index();
            $table->dateTime('created_at')->nullable(false)->comment('创建时间');
            $table->dateTime('updated_at')->nullable(false)->comment('更新时间');
            $table->dateTime('deleted_at')->nullable(true)->comment('删除时间');
        });
        $this->comment('news_contents', '新闻内容');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('news_contents');
    }
}
